package org.scaffold.config;

import de.tototec.cmdoption.CmdOption;
import de.tototec.cmdoption.handler.StringFieldHandler;

import java.util.LinkedHashMap;
import java.util.Map;


/**
 * 配置超类
 */
public abstract class GenerateConfig {
    @CmdOption(names = {"--config-path", "-path"}, description = "配置保存路径",
            args = {"value"}, handler = PathOptionConfigHandle.class)
    public static String generatePath;
    @CmdOption(names = {"--config-jdbcType", "-jdbcType"}, description = "配置数据库类型对应java类型,jdbc:数据库类型,java:java类型",
            args = {"jdbc", "java"}, minCount = 0, maxCount = -1, handler = JdbcTypeOptionConfigHandle.class)
    public static Map<String, String> jdbcType = new LinkedHashMap<String, String>();
    /**
     * 数据访问完整地址
     */
    @CmdOption(names = {"--config-databaseUrl", "-url"},
            description = "配置数据访问地址,例如:jdbc:mysql://ip:port?user=&password=&useUnicode=true&characterEncoding=UTF8",
            args = {"value"}, handler = DatabaseOptionConfigHandle.class)
    public static String databaseUrl;

    @CmdOption(names = {"--help", "-h"}, description = "显示帮助", isHelp = true)
    public static boolean help;

    public void clearOption() {
        help = false;
        jdbcType.clear();
    }


}
